<?php
	@header("Content-type:text/html;charset=utf-8");
	session_start();
	$adminName = 'admin';
	$adminPass = 'abc123';
	if($_POST){
		//print_r($_POST);exit;
		$loginusername = $_POST['username'];
		$loginpass = $_POST['passwd'];
		if( ($loginusername === 'admin') &&　('abc123' ===$loginpass)){
			@header('Location:admin.php');
			exit;	
		}else{
			echo "<script>alert('用户名密码错误，请重新登陆');</script>";
			@header('Location:login.php');
			exit;	
		}
	}else{
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>登陆</title>
</head>

<body>
<form action="login.php" method="post">
	用户名：<input type="text" name="username"><br>
    密  码：<input type="password" name="passwd"><br>
    <input type="submit" value="登陆">

</form>
</body>
</html>
<?php
	}
?>
